package com.cadre.common.utils.common;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Objects;

/* loaded from: RealUrlUtil.class */
public class RealUrlUtil {
    private RealUrlUtil() {
    }

    public static String getRealUrl() {
        String url = "/";
        try {
            url = URLDecoder.decode(((URL) Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource(""))).getPath(), "UTF-8").substring(1);
            System.out.println("测试服务器地址目录，打印当前取到的数据来源，url:" + url);
            url = url.substring(0, url.indexOf('/', url.indexOf('/', url.indexOf('/') + 1) + 1));
            System.out.println("测试服务器地址目录，打印当前取到的数据来源，url:" + url);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return url;
    }

    public static String getRootUrl() {
        return new File(new File(new File(getRealUrl()).getParent()).getParent()).getAbsolutePath();
    }
}
